/**
 * Created by Administrator on 2016/4/27 0027.
 */
document.write("<script language='javascript' src='/resources/js/views/defineTable.js'></script>");
document.write("<script language='javascript' src='/resources/js/query/queryReportByAreaAndIndicator.js'></script>");
document.write("<script language='javascript' src='/resources/js/load/loadIndicatorFromsType.js'></script>");
var iHeight = document.documentElement.clientHeight-200;//判断表格自适应高度
var ttIndicatorSelectCache= [];

//清除图形和表格数据
function clearData(){
    $("#annualAnalysis_containerzhuzi").html('');   //清空图形
    $("#annualAnalysis_containerzhuzi").height("0px");
    $("#annualAnalysis_containerzhuzi").width("0px");
    $('#annualAnalysis_tt').datagrid({data:[]});
}
var page = 1;
var pageSize = 30;
var isShow = true;

function query() {
	queryByFormsInameAreaIndicatorType(page,pageSize,ENUM_AREA_PROVINCE, ttIndicatorSelectCache);
}

function queryList() {
	queryByFormsInameAreaIndicators(page, pageSize,ENUM_AREA_PROVINCE, ttIndicatorSelectCache);
}


$(function(){
	ttIndicatorSelectCache=[];
	onlyLoadYear();
	loadFormAndOnlyIndicatorType();
	$('#iname').textbox({prompt:'指标输入'});
});

var show = {
	tableshow:function () {
		show.a = !show.a;
		if(show.a){
			$("#annualAnalysis_chart").panel("expand",true);
		}
	},
	photoshow:function () {
		show.a = false;
	},
	chartshow:function(){
		show.a = true;
	}
};

//导出Excel文件
function Save_Excel() {
	// if(isCheck.length==0){
 	// 	$.messager.alert('系统提示','请先勾选需要导出的指标，如需要导出所有指标数据请全选指标!','info')
 	// 	return;
 	// }
	var grid = $("#annualAnalysis_tt");
	// var rows=grid.datagrid("getRowss");					  //获得表格行数据 getRowss
	var name='省级领域分析';
	var colums_all=grid.datagrid("options").columns;      		     //获得表格的所有列不包括冻结列
	var columses=[];
	var columss=[];
	for (var i = 1; i < colums_all[0].length; i++) {
		columss.push(colums_all[0][i]);
	}
	columses[0]=columss;
	var getSelections = grid.datagrid("getSelections");     //获得表格选中行数据 getSelections
	var obj = $.ExportExcelDlg({
		HeadInfo: columses,    //表头栏
		RowInfo: getSelections,		   //数据航
		FooterInfo: grid.datagrid("getFooterRows"),
		RowStart: 2,		   //导出行位置
		ColumStart: 2,		   //导出列位置
		SheetName: name,
		MainTitle: { Displayname: name, Alignment: 'Center' },
		SaveName: name,
		Swf: 'ExportExcel.swf'
	});
	obj.ExportExcelDlg('open');
}